#include "course.h"

course::course()
{
	stages = std::list<Stage>();
}

bool course::loadcourse(std::string filename, engine e)
{
	std::ifstream course(filename.c_str());

	if(course == NULL)
	{
		course.close();
		return false;
	}

	std::string s = "";

	while(course.eof() == false)
	{
		course >> s;
		if(course.fail())
		{
			course.close();
			return false;
		}

		Stage st = Stage();

		if(st.LoadStage(s, e) == false)
		{
			course.close();
			return false;
		}
		else
		{
			stages.push_back(st);
		}
	}

	current = stages.begin();
}

Stage course::getStage()
{
	return *current;
}

void course::nextStage()
{
	current++;
}

void course::Update(Uint32 dticks)
{
	current->Update(dticks);
}
